package com.ruoyi.tongyan.service.impl;

import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.web.domain.server.Sys;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tongyan.mapper.TProjectProcessMapper;
import com.ruoyi.tongyan.domain.TProjectProcess;
import com.ruoyi.tongyan.service.ITProjectProcessService;

/**
 * 项目过程Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-19
 */
@Service
public class TProjectProcessServiceImpl implements ITProjectProcessService
{
    @Autowired
    private TProjectProcessMapper tProjectProcessMapper;

    /**
     * 查询项目过程
     *
     * @param processId 项目过程主键
     * @return 项目过程
     */
    @Override
    public TProjectProcess selectTProjectProcessByProcessId(Long processId)
    {
        return tProjectProcessMapper.selectTProjectProcessByProcessId(processId);
    }

    /**
     * 查询项目过程列表
     *
     * @param tProjectProcess 项目过程
     * @return 项目过程
     */
    @Override
    public List<TProjectProcess> selectTProjectProcessList(TProjectProcess tProjectProcess)
    {
        tProjectProcess.setUserId(SecurityUtils.getUserId());
        tProjectProcess.setProjectId(tProjectProcess.getProjectId());
        return tProjectProcessMapper.selectTProjectProcessList(tProjectProcess);
    }

    /**
     * 新增项目过程
     *
     * @param tProjectProcess 项目过程
     * @return 结果
     */
    @Override
    public int insertTProjectProcess(TProjectProcess tProjectProcess)
    {
        //自动填充登录用户的id和初始评审状态未草稿状态
        tProjectProcess.setUserId(SecurityUtils.getUserId());
        tProjectProcess.setReviewStatu("3");
        return tProjectProcessMapper.insertTProjectProcess(tProjectProcess);
    }

    /**
     * 修改项目过程
     *
     * @param tProjectProcess 项目过程
     * @return 结果
     */
    @Override
    public int updateTProjectProcess(TProjectProcess tProjectProcess)
    {
        return tProjectProcessMapper.updateTProjectProcess(tProjectProcess);
    }

    /**
     * 批量删除项目过程
     *
     * @param processIds 需要删除的项目过程主键
     * @return 结果
     */
    @Override
    public int deleteTProjectProcessByProcessIds(Long[] processIds)
    {
        return tProjectProcessMapper.deleteTProjectProcessByProcessIds(processIds);
    }

    /**
     * 删除项目过程信息
     *
     * @param processId 项目过程主键
     * @return 结果
     */
    @Override
    public int deleteTProjectProcessByProcessId(Long processId)
    {
        return tProjectProcessMapper.deleteTProjectProcessByProcessId(processId);
    }
}
